<AdminTpl file="Common/Head"/>
<body class="J_scroll_fixed">
<div class="wrap J_check_wrap">
  <AdminTpl file="Common/Nav"/>
  <form name="myform" action="{:U('Formguide/index')}" method="post" class="J_ajaxForm">
    <div class="table_list">
      <table width="100%" border="0" cellpadding="5" cellspacing="1" class="tableClass">
        <thead>
          <tr>
            <td width="12%" align="left">店铺ID</td>
            <td  align="center">店铺名称</td>
            <td  align="center">地址</td>
            <td width="35%" align="center">管理操作</td>
          </tr>
        </thead>
        <tbody>
          <volist name="list" id="vo" key="k">
            <tr>
              <td>{$vo.shop_id}</td>
              <td align="center"><font color=blue>{$vo.shop_name}</font></td>
              <td align="center"><font color=blue>{$vo.shop_address}</font></td>
              <td align="center"><a href="{:U('Shop/edit',array('id'=>$vo['shop_id']))}"> <font>查看详情</font></a> | 
              <if condition="$vo['status'] == 1">
              <a class="J_ajax_update" field="status" up_value="0" alert="确认关闭该商家吗？" href="{:U('Shop/ajax_edit',array('id'=>$vo['shop_id']))}"> <font>关闭</font> </a>
              <else/>
              <a class="J_ajax_update" field="status" up_value="1" alert="确认开通该商家吗？" href="{:U('Shop/ajax_edit',array('id'=>$vo['shop_id']))}"> <font>开通</font> </a>
              </if>
              
              </td>
            </tr>
          </volist>
        </tbody>
      </table>
      <div class="p10">
        <div class="pages">{$page}</div>
      </div>
    </div>
  </form>
</div>
<script src="/static/common/js/common.js?v"></script> 
<script src="/static/common/js/content_addtop.js"></script> 
<script>
        //调用
        function call(id) {
            omnipotent("call", GV.REAL_FILE+'?a=public_call&m=Formguide&g=Formguide&formid=' + id, "调用方式", 1, '700px', '300px');
        }
		 //所有的删除操作，删除数据后刷新页面
		 $(document).ready(function(e) {
             if ($('a.J_ajax_update').length) {
        Wind.use('artDialog', function () {
            $('.J_ajax_update').on('click', function (e) {
                e.preventDefault();
                var $_this = this,
                    $this = $($_this),
                    href = $this.prop('href'),
					data = {
						'field' : $this.attr("field"),
						'val' : $this.attr("up_value"),	
					},
					alert_msg = $this.attr("alert"),
                    msg = $this.data('msg');
					if(typeof(alert_msg)=="undefined") { alert_msg = "确定要操作吗？"};
                art.dialog({
                    title: false,
                    icon: 'question',
                    content: alert_msg,
                    follow: $_this,
                    close: function () {
                        $_this.focus();; //关闭时让触发弹窗的元素获取焦点
                        return true;
                    },
                    ok: function () {
                        $.getJSON(href,data).done(function (data) {
                            if (data.state === 'success') {
                                if (data.referer) {
                                    location.href = data.referer;
                                } else {
                                    reloadPage(window);
                                }
                            } else if (data.state === 'fail') {
                                alert(data.info);
                            }
                        });
                    },
                    cancelVal: '关闭',
                    cancel: true
                });
            });

        });
    }
        });
   
    </script>
</body>
</html>